home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / ColorSync / Sample Code / CSDemo 2.1 / ShellSources / dragUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-19  |  3.7 KB  |  110 lines  |  [TEXT/CWIE]

  1.  
  2. #ifndef _DRAGUTILS_
  3. #define _DRAGUTILS_
  4.  
  5.  
  6. #ifndef __DRAG__
  7. #include <Drag.h>
  8. #endif
  9.  
  10.  
  11. #ifndef __WINDOWS__
  12. #include <Windows.h>
  13. #endif
  14.  
  15.  
  16. /**\
  17. |**| ==============================================================================
  18. |**| PUBLIC TYPEDEFS
  19. |**| ==============================================================================
  20. \**/
  21.  
  22. typedef    struct    _DragZone  DragZoneRec, *DragZonePtr, **DragZoneHdl ;
  23. typedef    struct    _DragZones  DragZonesRec, *DragZonesPtr, **DragZonesHdl ;
  24.  
  25. typedef pascal OSErr (*DragZoneRecvProcPtr) (DragZoneHdl theZone,WindowRef theWindow,Point theLocation, Handle dataHdl) ;
  26.  
  27. #if GENERATINGCFM
  28. typedef UniversalProcPtr DragZoneRecvUPP;
  29. #else
  30. typedef DragZoneRecvProcPtr DragZoneRecvUPP;
  31. #endif
  32.  
  33. enum {
  34.     uppDragZoneRecvProcInfo = kPascalStackBased
  35.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  36.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DragZoneHdl)))
  37.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowRef)))
  38.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Point)))
  39.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Handle)))
  40. };
  41.         
  42. #if GENERATINGCFM
  43. #define NewDragZoneRecvProc(userRoutine)        \
  44.         (DragZoneRecvUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDragZoneRecvProcInfo, GetCurrentArchitecture())
  45. #else
  46. #define NewDragZoneRecvProc(userRoutine)        \
  47.         ((DragZoneRecvUPP) (userRoutine))
  48. #endif
  49.         
  50. #if GENERATINGCFM
  51. #define CallDragZoneRecvProc(userRoutine, theZone, theWindow, theLocation, dataHdl)        \
  52.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDragZoneRecvProcInfo, (theZone), (theWindow), (theLocation), (dataHdl))
  53. #else
  54. #define CallDragZoneRecvProc(userRoutine, theZone, theWindow, theLocation, dataHdl)        \
  55.         (*(userRoutine))((theZone), (theWindow), (theLocation), (dataHdl))
  56. #endif
  57.  
  58.  
  59. struct _DragZone
  60. {
  61.     Rect            rect ;
  62.     FlavorType        flavor ;
  63.     OSType            HFSfileType ; 
  64.     DragZoneRecvUPP    dragRecvUPP ;
  65.     void            *zoneRefCon ;
  66. } ;
  67.  
  68. struct _DragZones
  69. {
  70.     DragTrackingHandlerUPP    trackingHandler ;
  71.     DragReceiveHandlerUPP    receiveHandler ;
  72.     unsigned long            count ;
  73.     DragZoneHdl                item[] ;
  74. } ;
  75.  
  76.  
  77. /**\
  78. |**| ==============================================================================
  79. |**| PUBLIC FUNCTION PROTOTYPES
  80. |**| ==============================================================================
  81. \**/
  82. OSErr            Drag_present                ( void ) ;
  83. OSErr            Drag_available                ( void ) ;
  84. OSErr            Drag_initialize                ( void ) ;
  85. Boolean            DragIsInRect                ( DragReference drag, WindowRef window, Rect *rect ) ;
  86. Boolean            DragIsInSourceWindow        ( DragReference drag ) ;
  87. Boolean            DropLocationIsFinderTrash    ( DragReference drag ) ;
  88.  
  89. DragZonesHdl    NewDragZones                ( void ) ;
  90. OSErr            AddDragZone                    ( DragZonesHdl zones, DragZonePtr zone ) ;
  91. OSErr            DelDragZone                    ( DragZonesHdl zones, DragZoneHdl zone ) ;
  92. short            FindDragZones                ( DragZonesHdl zones, FlavorType flavor, OSType HFSfileType,
  93.                                                 short index, short count, DragZoneHdl *result ) ;
  94.                                                 
  95. OSErr            InstallDragZonesHandlers    ( DragZonesHdl zones, WindowRef window ) ;
  96. OSErr            RemoveDragZonesHandlers        ( DragZonesHdl zones, WindowRef window ) ;
  97. pascal OSErr    DragZoneTrackingHandler        ( short theMessage, WindowRef theWindow, void *handlerRefCon, DragReference theDrag) ;
  98. pascal OSErr    DragZoneReceiveHandler        ( WindowRef theWindow, void *handlerRefCon, DragReference drag ) ;
  99. Boolean            DragZoneItemsAcceptable        ( DragReference drag, DragZonesHdl zones ) ;
  100. long            DragZoneIsInWhichRect        ( DragReference drag, WindowRef theWindow, DragZonesHdl zones ) ;
  101.  
  102. OSErr            RegisterDragAppleEvents        ( void ) ;
  103. pascal OSErr    HandleDragRecv                ( AppleEvent *theAppleEvent, AppleEvent *reply, long refCon ) ;
  104. OSErr            SendDragRecv                ( DragZoneHdl theZone, WindowRef theWindow, Point theLocation,
  105.                                                  Handle dataHdl, DragZoneRecvUPP theDragZoneRecvUPP ) ;
  106.  
  107. OSErr            OutlineRegion                ( RgnHandle theRgn ) ;
  108.  
  109.  
  110. #endif